import request from '@/utils/request'


/////////////////        工程登记表           ///////////////////////////////
//获取工程列表
export function getProjects(query) {
  return request({
    url: `/building/project/`,
    method: 'get',
    params: query
  })
}
export function getProjectsExcel(query) {
  return request({
    url: `/building/project/`,
    method: 'get',
    export: 1,
    params: query
  })
}
//添加工程
export function addProject(info) {
  return request({
    url: `/building/project/`,
    method: 'post',
    data: info
  })
}
//根据ID获取工程数据
export function getProjectById(info) {
  return request({
    url: `/building/project/${info.id}/`,
    method: 'get',
    params: info
  })
}
//更新工程数据
export function updateProject(info) {
  return request({
    url: `/building/project/${info.id}/`,
    method: 'put',
    data: info
  })
}
//删除工程数据
export function delProject(id) {
  return request({
    url: `/building/project/${id}/`,
    method: 'delete',
  })
}
export function delProjects(data) {
  return request({
    url: '/building/project/batch_delete/',
    method: 'delete',
    data
  })
}
//获取工程列表
export function getProjectList() {
  return request({
    url: '/building/project_list/',
    method: 'GET',
  })
}

//获取工程列表
export function getProjectSearchList(params) {
  return request({
    url: '/building/project_search/',
    method: 'GET',
    params
  })
}


////////////////////////     标书       /////////////////////////////

//获取标书类型数据
export function bidType_list(query) {
  return request({
    url: '/building/bid_type/',
    method: 'get',
    params: query
  })
}
//添加标书类型
export function addBidType(bidTypeInfo) {
  return request({
    url: '/building/bid_type/',
    method: 'post',
    data: bidTypeInfo
  })
}

//删除标书类型
export function delBidType(bidType_id) {
  return request({
    url: `/building/bid_type/${bidType_id}`,
    method: 'delete',
  })
}

//根据ID获取标书类型
export function editBidType(bidTypeInfo) {
  return request({
    url: `/building/bid_type/${bidTypeInfo.id}/`,
    method: 'get',
    params: bidTypeInfo
  })
}

//更新标书类型
export function updateBidType(bidTypeInfo) {
  return request({
    //url: '/building/bid_type/'+id+'/',
    url: `/building/bid_type/${bidTypeInfo.id}/`,
    method: 'put',
    data: bidTypeInfo
  })
}

///////////////////////    工程类型         /////////////////////////////

//获取工程类型列表
export function getCategory_list(query) {
  return request({
    url: '/building/category/',
    method: 'get',
    params: query
  })
}

//添加工程类型
export function addCategory(info) {
  return request({
    url: '/building/category/',
    method: 'post',
    data: info
  })
}

//删除工程类型
export function delCartgory(id) {
  return request({
    url: `/building/category/${id}/`,
    method: 'delete'
  })
}

//根据ID获取工程类型,回显信息
export function getCartgoryById(info) {
  return request({
    url: `/building/category/${info.id}/`,
    method: 'get',
    params: info
  })
}
//更新工程类型
export function updateCartgory(info) {
  return request({
    url: `/building/category/${info.id}/`,
    method: 'put',
    data: info
  })
}

///////////////////////    用户列表         /////////////////////////////
//获取用户列表
export function getUser(query) {
  return request({
    url: '/user/user_list/',
    method: 'get',
    params: query
  })
}

////////////////////    资料类型         /////////////////////////////
//获取资料类型列表
export function getDocTypes(params) {
  return request({
    url: '/building/doc_type/',
    method: 'GET',
    params
  })
}

//添加资料类型
export function addDocType(info) {
  return request({
    url: '/building/doc_type/',
    method: 'post',
    data: info
  })
}

//删除资料类型
export function delDocType(id) {
  return request({
    url: `/building/doc_type/${id}/`,
    method: 'delete'
  })
}

//根据ID获取资料类型,回显信息
export function getDocTypeById(info) {
  return request({
    url: `/building/doc_type/${info.id}/`,
    method: 'get',
    params: info
  })
}
//更新资料类型
export function updateDocType(info) {
  return request({
    url: `/building/doc_type/${info.id}/`,
    method: 'put',
    data: info
  })
}


////////////////////    工程档案         /////////////////////////////
//获取工程档案数据
export function getArchives(params) {
  return request({
    url: '/building/archive/',
    method: 'GET',
    params
  })
}
//添加档案 
export function addArchive(data) {
  return request({
    url: '/building/archive/',
    method: 'POST',
    data
  })
}
//添加档案 资料
export function fileUpload(data) {
  return request({
    url: '/building/file_upload/',
    method: 'POST',
    data
  })
}
//删除资档案 
export function delArchive(id) {
  return request({
    url: `/building/archive/${id}/`,
    method: 'DELETE'
  })
}
//根据ID获取档案 ,回显信息
export function getArchiveById(params) {
  return request({
    url: `/building/archive/${params.id}/`,
    method: 'GET',
    params
  })
}
//更新档案
export function updateArchive(data) {
  return request({
    url: `/building/archive/${data.id}/`,
    method: 'PUT',
    data
  })
}
///////档案资料
//获取档案资料数据
export function getDocuments(params) {
  return request({
    url: '/building/document/',
    method: 'get',
    params
  })
}

export function delDocument(id) {
  return request({
    url: `/building/document/${id}/`,
    method: 'DELETE',
  })
}

export function getDocumentsByArchiveId(params) {
  return request({
    url: '/building/document_list/',
    method: 'get',
    params
  })
}
////////保证金开始/////////////
export function getDeposits(params) {
  return request({
    url: '/building/deposit/',
    method: 'GET',
    params
  })
}

export function addDeposit(data) {
  return request({
    url: '/building/deposit/',
    method: 'POST',
    data
  })
}

export function updateDeposit(data) {
  return request({
    url: `/building/deposit/${data.id}/`,
    method: 'PATCH',
    data
  })
}

export function delDeposit(data_id) {
  return request({
    url: `/building/deposit/${data_id}/`,
    method: 'DELETE',
  })
}
////////保证金结束/////////////

////////投标业务开始/////////////
export function getBidBusinesses(params) {
  return request({
    url: '/building/business/',
    method: 'GET',
    params
  })
}

export function addBidBusiness(data) {
  return request({
    url: '/building/business/',
    method: 'POST',
    data
  })
}

export function updateBidBusiness(data) {
  return request({
    url: `/building/business/${data.id}/`,
    method: 'PATCH',
    data
  })
}

export function delBidBusiness(data_id) {
  return request({
    url: `/building/business/${data_id}/`,
    method: 'DELETE',
  })
}
//删除检查人员
export function delBidInspector(data_id) {
  return request({
    url: `/building/inspector/${data_id}/`,
    method: 'DELETE',
  })
}

export function getBidDocuments(params) {
  return request({
    url: '/building/bid_document/',
    method: 'get',
    params
  })
}
//删除投标资料
export function delBidDocument(id) {
  return request({
    url: `/building/bid_document/${id}/`,
    method: 'DELETE',
  })
}

// export function getDocumentsByArchiveId(params) {
//   return request({
//     url: '/building/document_list/',
//     method: 'get',
//     params
//   })
// }

////////投标业务结束//////////
////工程项目财务综合统计
export function getPrjectFinances(params) {
  return request({
    url: '/building/finance/',
    method: 'GET',
    params
  })
}

export function addProjectFinance(data) {
  return request({
    url: '/building/finance/',
    method: 'POST',
    data
  })
}

export function updateProjectFinance(data) {
  return request({
    url: `/building/finance/${data.id}/`,
    method: 'PATCH',
    data
  })
}

export function delProjectFinance(data_id) {
  return request({
    url: `/building/finance/${data_id}/`,
    method: 'DELETE',
  })
}

export function delFundsDetail(data_id) {
  return request({
    url: `/building/funds_detail/${data_id}/`,
    method: 'DELETE',
  })
}